#include "qpropertyundocommand.h"

#include "qcommandobject.h"

using namespace CORELIB;

QPropertyUndoCommand::QPropertyUndoCommand(const QMap<QString, QVariant> &param, QUndoCommand *parent):
    QAbstractUndoCommand(param,parent)
{
}

int QPropertyUndoCommand::id()const
{
    return PROPERTY_UNDO_ID;
}

bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other)
{
    QPropertyUndoCommand* cmd=(QPropertyUndoCommand*)other;

    QObject* obj=cmd->object();
    if(obj->property("property").toInt()==m_object->property("property").toInt())
    {
        m_object->setProperty("new_value",obj->property("new_value"));
        return true;
    }
    else
    {
        return false;
    }
}
